<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="author" content="wangbo">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>react 传值 </title>
</head>
<body>
    <div id="app"></div>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <!-- 专门设置props的库 -->
    <script src="../js/prop-types.js"></script>
    <script src="../js/babel.min.js"></script>      
    <script type="text/babel">
    function Person(props) {
        return <h1>我是传递的值{props.name} 我的年龄是{props.age} </h1>
    }
    Person.defaultProps={
        age:20
    }
    // 规定传来的类型
    Person.propTypes={
        age:PropTypes.number,
        // 这个值必须传
        // 固定传来的类型,还要毕传
        gender:PropTypes.string.isRequired
    }
    
    const myp ={name:'李四',age:20}
    ReactDOM.render(<Person name='张三'   age={30} gender='男'  />,document.getElementById('app'))
    </script>
</body>
</html>